package com.example.mobile2021606128wje0404;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private ImageView imageView;
    private Button button;
    private int[] lines;
    private  int linesID=0;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
        initView();
        lines = new int[6];
        lines[0]=R.drawable.one;
        lines[1]=R.drawable.two;
        lines[2]=R.drawable.three;
        lines[3]=R.drawable.four;
        lines[4]=R.drawable.five;
        lines[5]=R.drawable.six;
        imageView.setImageResource(lines[linesID]);
        button.setOnClickListener( new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                imageView.setImageResource( lines[linesID+1] );
                linesID+=1;
            }
        } );


    }

    private void initView() {
        imageView = (ImageView) findViewById( R.id.imageView );
        button = (Button) findViewById( R.id.button );
    }
}